var MongoClient = require('mongodb').MongoClient;
var ejs_sass = 'mongodb://localhost:27017/ejs_sass';
var selectData = function(db, callback) { 
	//连接到数据库   
	var Users = db.collection('users');
	//增加数据
	var shuju = {userid:'admin',password: "123456"};
	Users.insert(shuju);//remove删除数据
	//查询数据
	Users.find().toArray(function(err, result) {
		if(err) {
			console.log('Error:' + err);
			return;
		}
		callback(result);
	});
}

MongoClient.connect(ejs_sass, function(err, db) {
	console.log("接入数据！");
	selectData(db, function(result) {
		console.log(result);
		db.close();
	});
});